# Maintainer: yumetodo <yume-wikijp@live.jp>

_realname=hexyl
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.12.0
pkgrel=1
pkgdesc="A command-line hex viewer"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://github.com/sharkdp/hexyl"
license=('spdx:Apache-2.0' 'spdx:MIT')
depends=()
makedepends=("${MINGW_PACKAGE_PREFIX}-rust")
source=(
  "${url}/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz"
)
sha512sums=('0a6d212f15e6078f0f553b8598ed96ae8e34a7ad1e7aafee2ba435111a18fbf1f265464d6e3a30bed551cc8387dc5da4f87221f10073258dcdb93c985e14b21d')
b2sums=('162b1419d609a86c278dc482abf4dfb68df37667f392bebd466f6154fda53a18b0505a2f71e0d78d871cb1537325565f35f369eddc255a5cda5166d6d13bebb8')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cargo build --release --locked
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  cargo test --release --locked
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  install -Dm 755 "target/release/${_realname}" "${pkgdir}${MINGW_PREFIX}/bin/${_realname}"
  install -Dm 644 LICENSE* -t "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
}
